﻿using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.Configuration;
using System;

namespace RockBus.Composition.Interfaces
{
    public class DependencyManager
    {
        private static readonly Lazy<IDependencyManager> _instance = new Lazy<IDependencyManager>(() =>
        {
            IUnityContainer uc = new UnityContainer();
            uc.LoadConfiguration();

            var instance = uc.Resolve<IDependencyManager>();
            return instance;
        }, true);

        public static IDependencyManager Instance { get { return _instance.Value; } }
    }
}